<%
	require 'controller/selection_helper'

	selectionHelper = SelectionHelper.new

	#一覧の取得(暫定的に全て取得)
	selections = selectionHelper.list()

%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
		<title>Edit Selection</title>
	</head>
	<body>
		<div id="container">

			<div id="header">
				<h2>選択肢の編集</h2>	
			</div>
			
			<div id="center-panel">
				<div id="add-selection">
					<p>現在の選択肢数:<%= selections != nil ? selections.size : 0%></p>
					<form name="selection-form" action="add_selection.rhtml" method="post" accept-charset="utf-8">
						<p>選択肢を入力して追加ボタンを押してください。<span style="color:red">上限1000字</span></p>
						<!--TODO:入力チェック。-->
						<p>選択肢：<input class="selection-content" type="text" name="selection-content" value="" maxlength="1000" size="40"></p>
						<p><input type="submit" value="追加" onclick="return true;"></p>
					</form>
				</div>
				<div id="selection-list">
					<% if selections != nil 
								selections.each_with_index { |s, i| %>
						<div class="selections">
							<p><span>id：<%= s.id%></span><span style="margin-left:10px;">内容：<%= s.content%></span></p>
						</div>
					<%}
					   end %>
				</div>
			</div>
			
			<div id="footer">
			</div>
					
		</div>
	</body>
</html>